package cn.edu.ldu.protocol;

import cn.edu.ldu.controller.GroupController;
import cn.edu.ldu.entity.ChatMemberEntity;
import cn.edu.ldu.util.L;
import cn.edu.ldu.views.controller.MainUIController;
import com.alibaba.fastjson.JSONObject;

import java.util.List;

public class ChatMember {

    public ChatMember(Protocol protocol){
        /**
         * 获得群聊成员
         */
        List<ChatMemberEntity> chatMenber =JSONObject.parseArray(protocol.getData(),ChatMemberEntity.class);
        L.OK(chatMenber,ChatMemberEntity.class);

        /**
         * 将群聊成员都添加到一个list中
         */
        for (ChatMemberEntity u : chatMenber){
            GroupController.addGroupmenberList(u);
        }

        MainUIController.getMainUI().setChatMember(chatMenber);

    }
}
